package com.mdb.open.epay.schedule.handler;

import com.mdb.bc.api.data.ResultEx;
import com.mdb.open.epay.facade.epay.TradeFacade;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Log4j2
@JobHandler(value = "retryQpRefundOrderJobHandler")
@Component
public class RetryQpRefundOrderJobHandler extends IJobHandler {

    @Autowired
    private TradeFacade tradeFacade;

    @Override
    public ReturnT<String> execute(String config) throws Exception {
        XxlJobLogger.log("開始執行快捷支付超時退款訂單重試任務...");
        ResultEx result = tradeFacade.produceRetryQpRefundOrders();
        XxlJobLogger.log("結束執行快捷支付超時退款訂單重試任務：" + result.toString());
        return SUCCESS;
    }
}
